const { Schema, model } = require('mongoose');
const moment = require('moment');

//设置数据集合
const carSchema = new Schema({
    userID: {
        type: Schema.Types.ObjectId,  // mongoose 中 _id 属性的类型
        ref: 'User'  // 指定关联集合的模型名称
    },
    model: String,
    licensePlate: String,
    motorcycleType: String,
    seat: String,
    imgs: Array,
    address: String,
    value: Number,
    rent: Number,
    verifyMsg: String,
    createTime: {
        type: String,
        default: moment().format('YYYY年MM月DD日')
    },
    status: {
        type: String,
        default: '未出租'
    },
    verify: {
        type: String,
        default: '未审核'
    },
    commentList: Array,


}, { versionKey: false });

//设置数据集合的模型
const Car = model('Car', carSchema, 'car');

//暴露
module.exports.Car = Car;